﻿/************************************************************************
 * Copyright (c) 2008, Jason Whitehorn (jason.whitehorn@gmail.com)
 * All rights reserved.
 * 
 * Source code and binaries distributed under the terms of the included
 * license, see license.txt for details.
 ************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;

namespace ContractTest {
    /// <summary>
    /// Exception type thrown when an assertion fails.
    /// </summary>
    public class ContractAssertionException : ContractTestException {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="message">The message for the exception</param>
        public ContractAssertionException(string message) : base(message) {}

        /// <summary>
        /// Constructs a ContractAssertionException when a type expectation fails.
        /// </summary>
        /// <param name="expectedType">The expected type/</param>
        /// <param name="actualType">The actual type.</param>
        public ContractAssertionException(TypeType expectedType, TypeType actualType)
            : base(string.Format("Expected {0} type, actual type was {1}", expectedType, actualType)) {}

        /// <summary>
        /// Contructs a ContractAssertionException when a visibility expectation fails.
        /// </summary>
        /// <param name="expectedVisibility">The expected visibility.</param>
        /// <param name="actualVisibility">The actual visibility.</param>
        public ContractAssertionException(VisibilityModifier expectedVisibility, VisibilityModifier actualVisibility)
            : base(string.Format("Expected {0} visibility, actual visibility was {1}", expectedVisibility, actualVisibility)) { }
    }
}
